	<?php $this->load->view('admin/partials/show_menu'); ?>
	<?php 
		$ci = &get_instance();
		$bidStatus = bidStatusDataConfig();
	?>
	<h3>Shows &raquo; <?php echo ucfirst($this->uri->segment(4,''));?></h3>
	<?php //$buttons = array('buttons'=>array('add#show_add();') );?>
	<?php //$this->load->view('admin/partials/buttons', $buttons ); ?>
	
	<div class="clrboth"></div>
	
	<?php //$this->load->view('admin/show/search_partial' ); ?>
	<div class="clrboth"></div>
	
	<table border="0" class="table-list">
		<thead>
			<tr>
				<th>Bid Ref</th>
				<th>Account code</th>
				<th>Buyer name</th>
				<th>Show name</th>
				<th>Artist</th>
				<th>Bid date</th>
				<th>Status</th>
				<th><?php echo lang('dataman.manage'); ?></th>
			</tr>
		</thead>
		
		<tbody>
			<?php foreach( $items as $item ): ?>
			<?php 
				$USER = $ci->user_entity->init('acc_code',$item->account_code);
				$SHOW = $ci->show_entity->init('ref_no',$item->show_ref_no);
			?>
			<tr>
				<td><a href="javascript:void(0);" onclick="_openDialogBidInfo(<?php echo $item->id;?>)"><?php echo $item->id; ?></a></td>
				<td><a href="javascript:void(0);" onclick="_openDialogUserInfo(<?php echo $USER->getId();?>)"><?php echo $USER->getAccCode(); ?></a></td>
				<td><?php echo $USER->getFirstName(). " ".$USER->getLastName() ;?></td>
				<td><?php echo $SHOW->getName(); ?></td>
				<td><?php echo $SHOW->getArtist(); ?></td>
				<td><?php echo sbxDateFormat($item->date_bid,'d-M-Y'); ?></td>
				<td>
					<?php 
						$status= "";
						if( $SHOW->getStatus() == "opening" ):
					?>
						<?php $status="bidding"; echo $bidStatus["bidding"];?>
					<?php elseif( $SHOW->getStatus() == "closed" ) : ?>
					<?php 
						if($SHOW->getUserBidWon() == $USER->getId()){
							$status="won";
							echo $bidStatus["won"];
						}else{
							$status="lost";
							echo $bidStatus["lost"];
						}	
					?>
					<?php endif;?>
				</td>
				<td>
					<?php 
						echo form_dropdown( 'bid_status',
											$options = array('bidding'=>'Bidding', 'won'=>'Won','lost'=>''),
											$selected = array($status),
											"id='bid_status' onchange='change_bid_status(this.value,{$item->id});' class='no-uniform'"
										);
					?>
					&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="_edit_bid(<?php echo $item->id;?>)"><?php echo lang('dataman.edit');?></a>
					&nbsp;|&nbsp;
					<a href="javascript:void(0);" onclick="_delete_bid(<?php echo $item->id;?>)" ><?php echo lang('dataman.delete');?></a>
				</td>
			</tr>
			<?php endforeach; ?>
		</tbody>
		
	</table>


